package com.pearlsoft.webapp.core.web.session;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


/**
 * 
 * @Creator haitingr
 * @Create-Date 2010-12-28
 */
public class SessionListener implements HttpSessionListener {

	protected static final Log logger = LogFactory.getLog(SessionListener.class);

	public void sessionCreated(HttpSessionEvent evt) {
		HttpSession session = evt.getSession();
		logger.info("remote session created [" + session.getId() + "]");
	}

	public void sessionDestroyed(HttpSessionEvent evt) {
		HttpSession session = evt.getSession();
		session.invalidate();
		logger.info("remote session closed [" + session.getId() + "]");
		SessionTracker.logout(session);
	}

}
